package sort;

import static sort.Common.printArray;

public class BubbleSort {
    public static void bubbleSort(int[] nums) {
        int len = nums.length;
        for (int i = 0; i < len; ++i) {
            for (int j = 0; j < len - i - 1; ++j) {
                if (nums[j] > nums[j + 1]) {
                    int tmp = nums[j];
                    nums[j] = nums[j + 1];
                    nums[j + 1] = tmp;
                }
            }
        }
    }

    public static void main(String[] args) {
        int[] nums = {1, 5, 2, 3, 0, -2, 6, 9, 8, 7};

        bubbleSort(nums);
    }
}
